package com.szhuang.mobilesafe.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;

/**
 * Created by szhuang on 2015/3/24.
 */
public class BootCompleteReceiver extends BroadcastReceiver {

    private SharedPreferences sp;
    private TelephonyManager telephonyManager;
    @Override
    public void onReceive(Context context, Intent intent) {
        sp=context.getSharedPreferences("config",Context.MODE_PRIVATE);
        telephonyManager= (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE);

        String saveSimInfo=sp.getString("sim","");
        String realSimInfo=telephonyManager.getSimSerialNumber();
        if(saveSimInfo.equals(realSimInfo)){

        }else{
            Log.i("console","SIM卡已经变更");
            Toast.makeText(context,"SIM卡已经变更",Toast.LENGTH_LONG).show();

        }
    }
}
